#include<iostream>
using namespace std;
int num[100][100];
int main(){//获取奇数阶幻方
    int n;cin>>n;
    int x=0,y=(n-1)/2;
    for(int i=1;i<=n*n;i++){
        // cout<<i<<" "<<x<<" "<<y<<endl;
        num[x][y]=i;
        if(x==0&&y!=n-1)x=n-1,y++;
        else if(x!=0&&y==n-1)x--,y=0;
        else if(x==0&&y==n-1)x++;
        else if(num[x-1][y+1]==0)x--,y++;
        else x++;
    }
    for(int i=0;i<=n;i++){
        for(int j=0;j<=n;j++){
            cout<<num[i][j]<<" ";
        }
        cout<<endl;
    }
    return 0;
}